package univer.oko.gui;

import javax.swing.*;
import java.util.Vector;

/**
 * @author Eduard Dudar
 *         DATE: 23.03.2005
 *         Copyright 2005
 */
public class CDDialogButtonPanel extends JPanel {
    private CDDialogButtonPanel(Object[] list) {
        super();
        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalGlue());
        for (int i = 0; i < list.length; i++) {
            if (list[i] instanceof CDButton) {
                box.add(Box.createHorizontalStrut(10));
                box.add((CDButton) list[i]);
            }
        }

        box.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
        this.add(box);
    }

    public static JPanel createButtonPane(Object[] list) {
        return new CDDialogButtonPanel(list);
    }

    public static JPanel createButtonPane(Vector list) {
        return new CDDialogButtonPanel(list.toArray());
    }
}
